package com.liuli.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 分类信息实体类
 * @author liyunf
 *
 */

@Entity/*(name="Category")*/
@Table(name = "category")
public class Category {
	
	private Integer cid;
	
	private String  cno;
	
	private String  cname;
	
	private String  pno;
	
	
	private List<Category> subCategory = new ArrayList<Category>();

	
	public Category() {
		// TODO Auto-generated constructor stub
	}
	
	
	public Category(String cno, String cname, String pno) {
		super();
		this.cno = cno;
		this.cname = cname;
		this.pno = pno;
	}
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getCid() {
		return cid;
	}

	public void setCid(Integer cid) {
		this.cid = cid;
	}

	public String getCno() {
		return cno;
	}

	public void setCno(String cno) {
		this.cno = cno;
	}

	public String getCname() {
		return cname;
	}

	public void setCname(String cname) {
		this.cname = cname;
	}

	public String getPno() {
		return pno;
	}

	public void setPno(String pno) {
		this.pno = pno;
	}

	/**
	 * 该字段不 映射
	 * @return
	 */
	
	
    @Transient
	public List<Category> getSubCategory() {
		return subCategory;
	}


	public void setSubCategory(List<Category> subCategory) {
		this.subCategory = subCategory;
	}


	@Override
	public String toString() {
		return "Category [cid=" + cid + ", cno=" + cno + ", cname=" + cname
				+ ", pno=" + pno + "]";
	}
	
	
	
	
	

}
